package com.icedata.sika.bridge

import net.mamoe.mirai.message.data.At

/**
 * Sika的At方法
 */
@MiraiBasedAPI
@MiraiSpecialAPI
class SikaAtMessage(private val miraiAtMessage: At) : SikaSingleMessage(miraiAtMessage) {

    /**
     * @param id 用户的QQ号
     **/
    @UserSikaAPI
    constructor(id: Long) : this(At(id))

    /**
     * @param contact 用户的[SikaUserContact]对象
     */
    @UserSikaAPI
    constructor(contact: SikaUserContact) : this(At(contact.id))

    /**
     * 对象的QQ号
     */
    val target: Long by lazy {
        return@lazy miraiAtMessage.target
    }

    override fun contentToString(): String {
        return "@${miraiAtMessage.target}"
    }

    override fun toString(): String {
        return "[Sika:At:${miraiAtMessage.target}]\n"
    }
}

fun at(qq: Long): SikaAtMessage {
    return SikaAtMessage(qq)
}